package online.niuma.xiaocubao.handler;

import online.niuma.xiaocubao.pojo.vo.Result;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author 一颗蛋50斤
 * IntelliJ IDEA
 *
 * 全局异常捕获
 */
@ControllerAdvice
public class AllExceptionHandler {

    @ResponseBody
    @ExceptionHandler(Exception.class)
    public Result doException(Exception e) {
        e.printStackTrace();
        return Result.fail(999, "系统异常");
    }
}
